// import Cookies from 'js-cookie'

// 将token存储方式从 Cookies 改为 sessionStorage
// 即关闭页面清除登录状态
// token
const TokenKey = 'Admin-Token'
export function getToken() {
  // return Cookies.get(TokenKey)
  return sessionStorage.getItem(TokenKey)
}

export function setToken(token) {
  // return Cookies.set(TokenKey, token)
  return sessionStorage.setItem(TokenKey, token)
}

export function removeToken() {
  // return Cookies.remove(TokenKey)
  return sessionStorage.removeItem(TokenKey)
}

// menu
const MenuKey = 'menuKey'

export async function getMenu() {
  return JSON.parse(sessionStorage.getItem(MenuKey))
}

export function setMenu(menu) {
  const menuJson = JSON.stringify(menu)
  return sessionStorage.setItem(MenuKey, menuJson)
}

export function clearMenu() {
  return sessionStorage.removeItem(MenuKey)
}

// button
const ButtonKey = 'buttonKey'

export function getButton() {
  return JSON.parse(sessionStorage.getItem(ButtonKey))
}

export function setButton(button) {
  const buttonJson = JSON.stringify(button)
  return sessionStorage.setItem(ButtonKey, buttonJson)
}

export function clearbutton() {
  return sessionStorage.removeItem(ButtonKey)
}

// UserNum
const UserNumKey = 'UserNum'

export function getUserNum() {
  return sessionStorage.getItem(UserNumKey)
}

export function setUserNum(UserNum) {
  return sessionStorage.setItem(UserNumKey, UserNum)
}

export function clearUserNum() {
  return sessionStorage.removeItem(UserNumKey)
}

// userNo
const userNoKey = 'userNo'

export function getUserNo() {
  return sessionStorage.getItem(userNoKey)
}

export function setUserNo(userNo) {
  return sessionStorage.setItem(userNoKey, userNo)
}

export function clearUserNo() {
  return sessionStorage.removeItem(userNoKey)
}

// UserName
const UserNameKey = 'UserName'

export function getUserName() {
  return sessionStorage.getItem(UserNameKey)
}

export function setUserName(UserName) {
  return sessionStorage.setItem(UserNameKey, UserName)
}

export function clearUserName() {
  return sessionStorage.removeItem(UserNameKey)
}

// branchId
const branchIdKey = 'branchId'

export function getBranchId() {
  return sessionStorage.getItem(branchIdKey)
}

export function setBranchId(BranchId) {
  return sessionStorage.setItem(branchIdKey, BranchId)
}

export function clearBranchId() {
  return sessionStorage.removeItem(branchIdKey)
}

// BranchNum
const BranchNumKey = 'BranchNum'

export function getBranchNum() {
  return sessionStorage.getItem(BranchNumKey)
}

export function setBranchNum(BranchNum) {
  return sessionStorage.setItem(BranchNumKey, BranchNum)
}

export function clearBranchNum() {
  return sessionStorage.removeItem(BranchNumKey)
}

// branchName
const branchNameKey = 'BranchName'

export function getBranchName() {
  return sessionStorage.getItem(branchNameKey)
}

export function setBranchName(branchName) {
  return sessionStorage.setItem(branchNameKey, branchName)
}

export function clearBranchName() {
  return sessionStorage.removeItem(branchIdKey)
}

// LegalPersonNum
const LegalPersonNumKey = 'LegalPersonNum'

export function getLegalPersonNum() {
  return sessionStorage.getItem(LegalPersonNumKey)
}

export function setLegalPersonNum(LegalPersonNum) {
  return sessionStorage.setItem(LegalPersonNumKey, LegalPersonNum)
}

export function clearLegalPersonNum() {
  return sessionStorage.removeItem(LegalPersonNumKey)
}

// LegalPersonNumKey
const LegalPersonNameKey = 'LegalPersonName'

export function getLegalPersonName() {
  return sessionStorage.getItem(LegalPersonNameKey)
}

export function setLegalPersonName(LegalPersonNum) {
  return sessionStorage.setItem(LegalPersonNameKey, LegalPersonNum)
}

export function clearLegalPersonName() {
  return sessionStorage.removeItem(LegalPersonNameKey)
}

// isFirstLoginFLag
const isFirstLoginFLagKey = 'isFirstLoginFLag'

export function getIsFirstLoginFLag() {
  return sessionStorage.getItem(isFirstLoginFLagKey)
}

export function setIsFirstLoginFLag(isFirstLoginFLag) {
  return sessionStorage.setItem(isFirstLoginFLagKey, isFirstLoginFLag)
}

export function clearIsFirstLoginFLag() {
  return sessionStorage.removeItem(isFirstLoginFLagKey)
}
// appNum
const appNumKey = 'appNum'

export function getAppNum() {
  return sessionStorage.getItem(appNumKey)
}

export function setAppNum(appNum) {
  return sessionStorage.setItem(appNumKey, appNum)
}

export function clearAppNum() {
  return sessionStorage.removeItem(appNumKey)
}
